import { ApiProperty, OmitType } from '@nestjs/swagger';

import { Article } from '../article.entity';
import { IsArray, IsInt, IsString } from 'class-validator';

export class AddArticleDto extends OmitType(Article, [
  'createdAt',
  'updatedAt',
  'id',
]) {}

export class TestAddArticleDto {
  // @ApiProperty({ required: false })
  // name: string;
  @ApiProperty()
  @IsInt()
  gatherId: number;

  @ApiProperty()
  @IsString()
  name: string;

  @ApiProperty()
  @IsString()
  content: string;

  @ApiProperty()
  @IsInt()
  vipLevel: number;

  @ApiProperty()
  @IsInt()
  sortOrder: number;
}

export class AddPushArticleDto {
  @ApiProperty()
  @IsInt()
  gatherId: number;

  @ApiProperty()
  @IsString()
  name: string;

  @ApiProperty()
  @IsString()
  content: string;

  @ApiProperty()
  @IsString()
  enContent: string;

  @ApiProperty()
  @IsInt()
  vipLevel: number;

  @ApiProperty()
  @IsInt()
  sortOrder: number;
}

export class TestBatchAddArticleDto {
  // @ApiProperty({ required: false })
  // name: string;
  @ApiProperty()
  @IsInt()
  gatherId: number;

  @ApiProperty()
  @IsArray()
  contentList: TestAddArticleDto[];

  @ApiProperty()
  @IsInt()
  vipLevel: number;
}
